<template>

  <map id="map" class="map" :longitude="postion.lng" :latitude="postion.lat" scale="14" show-location="true" :polyline="lines" bindmarkertap="makertap" @click="doto"></map>

</template>
<script>
import { bMapTransQQMap } from '@/utils/baiduMapTotencentMap.js'
export default {
  props: {
    postion: {
      type: Object,
      default: () => ({ lng: null, lat: null })
    },
    line: {
      type: Array,
      default: () => []
    },
    iconPath: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      Bmap: null,
      lines: [{
        points: [],
        color: '#31c27c',
        width: 10,
        arrowLine: true,
        borderWidth: 2 // 线的边框宽度，还有很多参数，请看文档
      }]

    }
  },
  created() {
    const arr = this.line
    arr.map((item) => {
      const point = bMapTransQQMap(item.longitude, item.latitude)
      const obj = { latitude: point[1], longitude: point[0] }
      return obj
    })
    this.lines[0].points = arr
  }

}
</script>
<style scoped>

.map {
    height: 500rpx;
    width:750rpx;
}

</style>